package com.lj.play;

import org.junit.Test;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

public class Director {
    //spring配置文件 构造函数注入
    @Test
    public void direct(){
        ApplicationContext ac = new ClassPathXmlApplicationContext("applicationContext.xml");
        MoAttack moAttack = ac.getBean("moAttack",MoAttack.class);
        moAttack.cityGateAsk();
    }

    //spring配置文件 属性注入
    @Test
    public void direct2(){
        ApplicationContext ac = new ClassPathXmlApplicationContext("applicationContext2.xml");
        MoAttack moAttack = ac.getBean("moAttack",MoAttack.class);
        moAttack.cityGateAsk();
    }
    //spring配置文件 工厂模式注入
    @Test
    public void direct3(){
        ApplicationContext ac = new ClassPathXmlApplicationContext("applicationContext3.xml");
        MoAttack moAttack = ac.getBean("moAttack",MoAttack.class);
        moAttack.cityGateAsk();
    }
    //spring配置文件 静态工厂模式注入
    @Test
    public void direct4(){
        ApplicationContext ac = new ClassPathXmlApplicationContext("applicationContext4.xml");
        MoAttack moAttack = ac.getBean("moAttack",MoAttack.class);
        moAttack.cityGateAsk();
    }
}
